<?php

/**
 * AcctBalanceSheet form base class.
 *
 * @method AcctBalanceSheet getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAcctBalanceSheetForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'year'            => new sfWidgetFormInputText(),
      'month'           => new sfWidgetFormInputText(),
      'acct_subject_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSubject'), 'add_empty' => false)),
      'begin_amount'    => new sfWidgetFormInputText(),
      'end_amount'      => new sfWidgetFormInputText(),
      'acct_set_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSet'), 'add_empty' => false)),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'year'            => new sfValidatorInteger(),
      'month'           => new sfValidatorInteger(),
      'acct_subject_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSubject'))),
      'begin_amount'    => new sfValidatorNumber(),
      'end_amount'      => new sfValidatorNumber(),
      'acct_set_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctSet'))),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('acct_balance_sheet[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AcctBalanceSheet';
  }

}
